$.extend({
	contents:{},
	_default:6,
	_loads:6,
	hsf:{
		baseUrl:'http://wx.fanshe360.com',
		network:function(){
			var net;
			if(window.navigator.onLine==true){
				return net = 'succ'
			}
			else{
				return net = 'fail'
			}
		},
		ajaxPost(functionNo, data, jsonpname, callback, timeout){
			//var timestamp = (new Date()).valueOf();
			//data += "&timestamp=" + timestamp;
			var network = $.hsf.network();
			if(network == 'succ'){
				var request_temp = $.ajax({
					url: $.hsf.baseUrl + '/fanshe/api/' + functionNo + '.do',
					type: 'POST',
					dataType: 'json',
					contentType:'application/json',
					//jsonp: 'jsonpCallback',
					//jsonpCallback: 'hundsun_' +jsonpname+ timestamp,
					data: data,
					timeout: 6000
					}).done(function(res){
					callback && callback.call(this,res);
				}).fail(function(){
					var result = {
					'code': 'NETWORK_ERROR',
					'message': '接口异常'
					};
					callback && callback.call(this, result);
				})
				return request_temp;
			}else{
				var result = {
					'code': 'NETWORK_ERROR',
					'message': '网络异常'
				};
				callback && callback.call(this, result);
			}
		},

		ajaxPostT(functionNo, data, jsonpname, callback, timeout){
			//var timestamp = (new Date()).valueOf();
			//data += "&timestamp=" + timestamp;
			var network = $.hsf.network();
			if(network == 'succ'){
				var request_temp = $.ajax({
					url: $.hsf.baseUrl + functionNo + '.do',
					type: 'POST',
					//dataType: 'json',
					//contentType:'application/json',
					//jsonp: 'jsonpCallback',
					//jsonpCallback: 'hundsun_' +jsonpname+ timestamp,
					data: data,
					timeout: 6000
					}).done(function(res){
					callback && callback.call(this,res);
				}).fail(function(){
					var result = {
					'code': 'NETWORK_ERROR',
					'message': '接口异常'
					};
					callback && callback.call(this, result);
				})
				return request_temp;
			}else{
				var result = {
					'code': 'NETWORK_ERROR',
					'message': '网络异常'
				};
				callback && callback.call(this, result);
			}
		},
		ajaxGet(url,data,callback){
			var network = $.hsf.network();
			if(network == 'succ'){
				var request_temp = $.ajax({
					type:'GET',
					url: $.hsf.baseUrl + url,
					data:data
				}).done(function(res){
					callback && callback.call(this,res);
				}).fail(function(){
					var result = {
						'code': "NETWORK_ERROR",
						'message': '接口异常'
					};
					callback && callback.call(this, result);
				})
				return request_temp;
			}else{
				var result = {
					'code': 'NETWORK_ERROR',
					'message': '网络异常'
				};
				callback && callback.call(this, result);
			}
		},
		addcookie(name,value,expireHours){  
		    var cookieString=name+"="+escape(value)+"; path=/";  
		    //判断是否设置过期时间  
		    if(expireHours>0){  
		        var date=new Date();  
		        date.setTime(date.getTime+expireHours*3600*1000);  
		        cookieString=cookieString+"; expire="+date.toGMTString();  
		    }  
		    document.cookie=cookieString;  
		},
		getcookie(name){  
		    var strcookie=document.cookie;  
		    var arrcookie=strcookie.split("; ");  
		    for(var i=0;i<arrcookie.length;i++){  
		    var arr=arrcookie[i].split("=");  
		    if(arr[0]==name)return decodeURIComponent(arr[1]); //增加对特殊字符的解析  
		    }  
		    return "";  
		},
		delCookie(name){//删除cookie  
		    var exp = new Date();  
		    exp.setTime(exp.getTime() - 1);  
		    var cval=getcookie(name);  
		    if(cval!=null) document.cookie= name + "="+cval+"; path=/;expires="+exp.toGMTString();  
		},

		loadingLock: [],
		startLoading: function(message) { /*加载loading*/
			(null == message || "" == message) && (message = "请稍候");
			if ($.UILoadingIos) {
				this.loadingLock.push("");
				if (this.loadingLock.length > 0) {
					$.UILoadingIos("show", message)
				}
			};
		},
		stopLoading: function() { /*停止loading*/
			if (this.loadingLock.length <= 1) {
				$.UILoadingIos && $.UILoadingIos("hide");
				this.loadingLock = [];
			} else {
				this.loadingLock.pop();
			}
		}
	},
	local_Storage : {
		setItem:function(key,val) {
			localStorage.setItem(key,val);
        },
        getItem:function(key){
			return localStorage.getItem(key);
        },
        removeItem:function(key){
			localStorage.removeItem(key);
        },
        clear:function(){
			localStorage.clear();
        }
	},
	session_Storage : {
        setItem:function(key,val) {
			sessionStorage.setItem(key,val);
        },
        getItem:function(key){
			return sessionStorage.getItem(key);
        },
        removeItem:function(key){
			sessionStorage.removeItem(key);
        },
        clear:function(){
			sessionStorage.clear();
        }
    },
})
